this.globalThis || (this.globalThis = this);
(function (doc, win) {

  var docEl = doc.documentElement,
    resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
    setRem = function () {
      var mobileWidth = 750; // 手机375的尺寸
      var rootWidth = 1600; // 设计稿的字体尺寸  基本就1366×768、1600×900、1920×1080，这三个就可以了
      var minWidth = 1200;
      var clientWidth = docEl.clientWidth;
      if (!clientWidth) return;
      let size = 16;
      if (clientWidth > rootWidth) { // 屏幕大于 1600
        // 大于设计稿的尺寸
        size = 16;
      } else if (clientWidth >= minWidth) {  // 屏幕大于 1200
        size = 14 + 2 / 400 * (clientWidth - minWidth)
      } else if (clientWidth > mobileWidth) { // pad端
        size = 14
      } else { // 移动端
        size = 16 / 375 * clientWidth
        if (size > 20) {
          size = 20
        }
      }
      docEl.style.fontSize = size + "px";
    };

  setRem();
  if (!doc.addEventListener) return;

  win.addEventListener(resizeEvt, setRem, false);
  doc.addEventListener("DOMContentLoaded", setRem, false);
  win.addEventListener("pageShow", setRem, false);
})(document, window);
